package com.jeesite.modules.form.service;

import java.util.List;

import com.jeesite.common.utils.OrgUtil;
import com.jeesite.modules.common.vo.CommonSelectDataVO;
import com.jeesite.modules.form.entity.qo.FormQO;
import com.jeesite.modules.form.entity.vo.FormVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.form.entity.Form;
import com.jeesite.modules.form.dao.FormDao;

/**
 * 表单配置Service
 * @author 码脑洞
 * @version 2025-04-13
 */
@Service
public class FormService extends CrudService<FormDao, Form> {
	
	/**
	 * 获取单条数据
	 * @param form
	 * @return
	 */
	@Override
	public Form get(Form form) {
		return super.get(form);
	}
	
	/**
	 * 查询分页数据
	 * @param form 查询条件
	 * @param form page 分页对象
	 * @return
	 */
	@Override
	public Page<Form> findPage(Form form) {
		return super.findPage(form);
	}
	
	/**
	 * 查询列表数据
	 * @param form
	 * @return
	 */
	@Override
	public List<Form> findList(Form form) {
		return super.findList(form);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param form
	 */
	@Override
	@Transactional
	public void save(Form form) {
		super.save(form);
	}
	
	/**
	 * 更新状态
	 * @param form
	 */
	@Override
	@Transactional
	public void updateStatus(Form form) {
		super.updateStatus(form);
	}
	
	/**
	 * 删除数据
	 * @param form
	 */
	@Override
	@Transactional
	public void delete(Form form) {
		super.delete(form);
	}

	public Page<FormVO> findFormPage(FormQO formQO) {
		Page<FormVO> page = formQO.getPage();
		formQO.setOrgId(OrgUtil.getOrgId());
		page.setList(dao.findFormPage(formQO));
		return page;
	}

	public List<CommonSelectDataVO> selectFormList() {
		return dao.selectFormList();
	}

	public long getFormId(String formCode) {
		return dao.getFormId(formCode);
	}
}